/*
 * Email Notify
 * Author: Antonio Nastasi
 * Email: sifcenter (at) gmail.it
 * Version: 0.2
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef EMAILNOTIFY_H
#define EMAILNOTIFY_H

#include <KIcon> 
#include <Plasma/Applet>
#include <Plasma/Svg>

#include <QTimer>
#include <Phonon/MediaObject>
#include "ConfigDialog.h"
#include "EmailChecker.h"

class EmailNotify : public Plasma::Applet
{
    Q_OBJECT
    public:       
        EmailNotify(QObject *parent, const QVariantList &args);
        ~EmailNotify();        
        void paintInterface(QPainter *painter,
                const QStyleOptionGraphicsItem *option,
                const QRect& contentsRect);
	void init();
	
 
    private:
        Plasma::Svg m_svg;	
	void checkConfig();
        KIcon m_icon;	
	QString text;
	KConfig *config;
	KConfigGroup *generalGroup;
	QTimer *timer;	
	// For play sound
	Phonon::MediaObject *media;
	
	//int currentEmails;
	// For Configure Dialog	
	ConfigDialog configDialog;	
	EmailChecker emailChecker;	
	// Values
	QString server, protocol, login, password, sound_file;
	int interval,port,ssl;
	
    private slots:	
	void showConfigurationInterface();
	void checkEmails();	
	void playSound();
	void setText(QString);
};

K_EXPORT_PLASMA_APPLET(emailnotify, EmailNotify)
#endif
